<?php


namespace App\Controller;


class IndexController extends AppBaseController
{
    public function index()
    {
        exit("forbidden url");
    }

    public function banner()
    {
        $lists = D("Adv")->where(['status' => 1, 'pos_id' => 10000])->order("sort DESC,create_time DESC")->field("id,data,url")->select();

        $banners = [];
        $urlConfig = C("SID_URL_CONFIG");
        $imageBaseUrl = $urlConfig['imageUrl'];
        foreach ($lists as $val) {
            $data = json_decode($val['data'], true);
            $image = get_cover($data['pic'], 'path');
            $banner = [
                'id' => $val['id'],
                'imageUrl' => $imageBaseUrl . $image,
                'linkUrl' => $val['url']
            ];
            $banners[] = $banner;
        }
        $this->jsuccess($banners);
    }
}